from rest_framework import serializers

from app1.models import UserInfo, Addr


# 用户
class UserInfoSerializer(serializers.ModelSerializer):
    class Meta:
        model = UserInfo
        fields = '__all__'  # 添加这一行
        exclude = []


# 收货地址

class AddrSerializer(serializers.ModelSerializer):
    class Meta:
        model = Addr
        fields = '__all__'  # 添加这一行
        exclude = []
        # fields指定序列化返回的自动信息
        # fields = ('mobile', 'info')
        # exclude排除不需要序列化的字段(排除不需要参与序列化的字段)
        # exclude = ('id')
        # 参与序列化不参与反序列化
        # read_only_fields = ('id',)


